package cn.taobaoke.restful.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 微信群表。微信群和代理之间是多对多的关系。
 */
@Setter
@Getter
@ToString
@Table(name = "tb_wx_group")
@Entity
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WxGroupEntity implements Serializable {

    @Id
    @GeneratedValue
    private Long id;

    @Column
    private String name;

    @Column
    private String weChat;


    /* 表示微信组是否属于管理员, true属于管理员, false属于代理, 此时agentId存在值 */
    @Column
    private Boolean isBelongToAdmin;

    @Column
    private Long agentId;

    @Column
    private Long domainId;

    //==========================================================
    // 下面是装填插叙参数

    // 群里总人数
    @Transient
    private Integer total;


    @Transient
    private Integer orderTotal;

    // 代理人员
    @Transient
    private AgentEntity agent;

    // 成员列表
    @Transient
    private List<UserEntity> members;

}
